JavaScript Pad start

padStart() pads the front of a string with a filler until it reaches a target length, returning the padded copy. It is the classic way to zero-pad numbers or align text in columns.

Syntax

str.padStart(targetLength, padString)

Examples

Input Arguments Output
"5" 3, "0" "005"
↳ Zero-pad to width 3.

When to use it

  • Zero-pad numbers, times and IDs.
  • Right-align text in fixed-width output.

Try it live

Type your input and see Pad start transform it instantly.

Description: Pads the start of a string with a specified character to reach a specified length.

Example: 'pie'.padStart(10, '-') => '--------pie'

Want to go further? Chain Pad start with other functions in the visual Playground — pipe one output into the next and watch your data transform.

Related functions

© 2026 Heifara Buval